package org.budo.jdbc.dao.resultset.handler;

import java.sql.ResultSet;
import java.util.Map;

import org.budo.support.javax.sql.util.ResultSetUtil;

/**
 * @author lmw
 */
public class MapListResultSetHandler extends AbstractListResultSetHandler<Map> {
    private String[] columnLabels;

    @Override
    public Map handleResultSetRow(ResultSet resultSet) {
        if (null == resultSet) {
            return null;
        }

        if (null == this.columnLabels) {
            this.columnLabels = ResultSetUtil.getColumnLabels(resultSet);
        }

        return ResultSetUtil.toMap(resultSet, this.columnLabels);
    }
}